<?php


namespace backend\controllers;


use backend\models\SvnFileSearch;
use Yii;
use yii\grid\DataColumn;
use yii\grid\GridView;
use yii\web\Controller;

class TestController extends Controller
{
    public string $dataColumnClass;

    public function actionIndex()
    {
        $searchModel = new SvnFileSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        echo GridView::widget([
            'dataProvider' => $dataProvider,
            'filterModel'  => $searchModel,
            'columns'      => [
                ['class' => 'yii\grid\SerialColumn'],

                'svn_id',
                'file_id',
                'comment',
                'detail:ntext',

                ['class' => 'yii\grid\ActionColumn'],
            ],
        ]);
    }

    public function actionTest()
    {
        $arr = [
            'first' => '<p>hello:world</p>',
        ];
        $str = addslashes(json_encode($arr));
        $html = <<<HTML
<script>
    let obj = JSON.parse('{$str}');
    console.log(obj);
</script>
HTML;
        echo $html;
        die;
    }
}